﻿<UserControl x:Class="Big3.Hitbase.CDUtilities.PersonGroupProperties"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sr="clr-namespace:Big3.Hitbase.SharedResources;assembly=Big3.Hitbase.SharedResources"
             xmlns:local="clr-namespace:Big3.Hitbase.CDUtilities"
             xmlns:database="clr-namespace:Big3.Hitbase.DataBaseEngine;assembly=DataBaseEngine"
             mc:Ignorable="d" x:Name="pgUserControl"
             d:DesignHeight="521" d:DesignWidth="634" xmlns:my="clr-namespace:Big3.Hitbase.Controls;assembly=Controls"
             xmlns:misc="clr-namespace:Big3.Hitbase.Miscellaneous;assembly=Misc">
    <UserControl.Resources>
        <ItemsPanelTemplate x:Key="VirtualItemPanel">
            <VirtualizingStackPanel/>
        </ItemsPanelTemplate>
        <local:CountryItemSelector x:Key="countryItemSelector"/>
        <misc:DateConverter x:Key="dateConverter" />
        <local:SexTypeToIntConverter x:Key="sexTypeToIntConverter" />
        <local:PersonGroupTypeToIntConverter x:Key="personGroupTypeToIntConverter" />
        <database:MaxLengthConverter x:Key="maxLengthConverter" />
        <DataTemplate x:Key="CountryItemTemplate">
            <Grid Width="300">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Image Margin="0,0,2,0" Grid.Column="0" Source="{Binding FlagImageSource}" Width="16" Height="11" />
                <TextBlock Grid.Column="1" Text="{Binding CountryName}" />
                <Rectangle Name="Separator" Width="300" Height="1" Fill="Black" SnapsToDevicePixels="True" Visibility="Collapsed"></Rectangle>
            </Grid>
            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding CountryName}" Value="">
                    <Setter Property="Visibility" TargetName="Separator" Value="Visible" />
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
        <DataTemplate x:Key="CountryItemSeparatorTemplate">
            <Separator Margin="0,3,0,3" Height="1" Width="300" Background="Black" />
        </DataTemplate>
    </UserControl.Resources>
    <Grid TextElement.Foreground="{DynamicResource DefaultForeground}">
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="154,33,0,0" Name="textBlock1" Text="Name:" VerticalAlignment="Top" FontWeight="Bold" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="154,62,0,0" Name="textBlock2" Text="Speichern unter:" VerticalAlignment="Top" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="154,91,0,0" Name="textBlock3" Text="Art:" VerticalAlignment="Top" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="154,120,0,0" Name="textBlock4" Text="Geschlecht:" VerticalAlignment="Top" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="154,149,0,0" Name="textBlock5" Text="Herkunftsland:" VerticalAlignment="Top" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="12,181,0,0" Name="textBlockBirthDay" Text="Geboren am:" VerticalAlignment="Top" />
        <TextBlock Height="23" Margin="0,181,148,0" Name="textBlockDeath" Text="Gestorben am:" VerticalAlignment="Top" HorizontalAlignment="Right" Width="77" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="12,213,0,0" Name="textBlock8" Text="Homepage:" VerticalAlignment="Top" />
        <TextBox Text="{misc:BindingDirect Name}" Height="23" Margin="246,30,12,0" Name="textBoxName" VerticalAlignment="Top" FontWeight="Bold" LostFocus="textBoxName_LostFocus" MaxLength="{Binding Converter={StaticResource maxLengthConverter}, ConverterParameter=ArtistCDName}"/>
        <TextBox Text="{misc:BindingDirect SaveAs}" Height="23" Margin="246,59,12,0" Name="textBoxSaveAs" VerticalAlignment="Top" MaxLength="{Binding Converter={StaticResource maxLengthConverter}, ConverterParameter=ArtistCDSaveAs}"/>
        <ComboBox SelectedIndex="{Binding Type, Converter={StaticResource personGroupTypeToIntConverter}}" Height="23" HorizontalAlignment="Left" Margin="246,88,0,0" Name="comboBoxType" VerticalAlignment="Top" Width="183" SelectionChanged="comboBoxType_SelectionChanged" />
        <ComboBox SelectedIndex="{Binding Sex, Converter={StaticResource sexTypeToIntConverter}}" Height="23" HorizontalAlignment="Left" Margin="246,117,0,0" Name="comboBoxSex" VerticalAlignment="Top" Width="183" />
        <local:MyComboBox Text="{Binding Country}" Height="23" HorizontalAlignment="Left" Margin="246,146,0,0" x:Name="comboBoxCountry" ItemsPanel="{StaticResource VirtualItemPanel}" ScrollViewer.CanContentScroll="True" VerticalAlignment="Top" Width="183" IsEditable="True" TextChanged="comboBoxCountry_TextChanged" ItemTemplate="{StaticResource CountryItemTemplate}">
        </local:MyComboBox>
        <TextBox Text="{Binding Birthday, Converter={StaticResource dateConverter}}" Height="23" MaxLength="10" HorizontalAlignment="Left" Margin="103,178,0,0" Name="textBoxDateOfBirth" VerticalAlignment="Top" Width="128" />
        <TextBox Text="{Binding DayOfDeath, Converter={StaticResource dateConverter}}" Height="23" HorizontalAlignment="Right" Margin="0,178,12,0" Name="textBoxDateOfDeath" MaxLength="10" VerticalAlignment="Top" Width="128" />
        <TextBox Text="{misc:BindingDirect Homepage}" Height="23" Margin="103,210,39,0" Name="textBoxUrl" VerticalAlignment="Top" MaxLength="{Binding Converter={StaticResource maxLengthConverter}, ConverterParameter=ArtistCDHomepage}"/>
        <Image Margin="0,89,12,0" VerticalAlignment="Top" HorizontalAlignment="Right" Name="imageFlag" Height="80" Width="156" Stretch="Uniform" />
        <Button Height="23" HorizontalAlignment="Right" Margin="0,210,12,0" Name="buttonUrl" VerticalAlignment="Top" Width="21" Click="buttonUrl_Click">
            <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/Internet.png" />
        </Button>
        <my:ChoosePictureUserControl CoverType="PersonGroup" Artist="{Binding Name}" ImageFilename="{Binding ImageFilename, Mode=TwoWay}" HorizontalAlignment="Left" Margin="12,20,0,0" Name="choosePictureUserControl" VerticalAlignment="Top" Height="149" Width="128" HasDropShadow="True" />
        <TabControl Margin="12,243,12,54"  Name="tabControl" Background="Transparent">
            <TabItem Header="Mitwirkend(e)" Name="tabItemParticipants">
                <DockPanel>
                    <Grid Grid.Row="1" DockPanel.Dock="Top">
                        <Grid.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStopCollection>
                                    <GradientStop Color="#F1F3FF" Offset="0"/>
                                    <GradientStop Color="#E2E8FF" Offset="0.5"/>
                                    <GradientStop Color="#C8DFF7" Offset="0.51"/>
                                    <GradientStop Color="#CAE2F9" Offset="1"/>
                                </GradientStopCollection>
                            </LinearGradientBrush>
                        </Grid.Background>
                        <Grid.Resources>
                            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.3"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Resources>
                        <StackPanel Orientation="Horizontal" Margin="0,2,0,2">
                            <Button Name="ButtonAddParticipant" Click="ButtonAddParticipant_Click" Padding="2" Margin="2,0,2,0" ToolTip="Mitwirkenden hinzufügen">
                                <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/AddPersonGroup.png" Height="16" Width="16" />
                            </Button>
                            <Button Name="ButtonDeleteParticipant" Click="ButtonDeleteParticipant_Click" Padding="2" ToolTip="Mitwirkenden löschen">
                                <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/DeletePersonGroup.png" Height="16" Width="16" />
                            </Button>
                            <Button Name="ButtonOpenPersonGroup" Click="ButtonOpenPersonGroup_Click" Padding="2" ToolTip="Person/Gruppe anzeigen">
                                <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/PersonGroupGeneral.png" Height="16" Width="16" />
                            </Button>
                        </StackPanel>
                    </Grid>
                    <DataGrid AutoGenerateColumns="false" CanUserAddRows="false" CanUserDeleteRows="false" Name="dataGridParticipants" Background="Transparent"
                              CanUserSortColumns="False" CanUserResizeRows="False" SelectionChanged="dataGridParticipants_SelectionChanged"
                              BorderThickness="0" HeadersVisibility="Column" RowHeaderWidth="0" SelectionUnit="FullRow" EnableRowVirtualization="True" 
                              EnableColumnVirtualization="False" PreviewKeyDown="dataGridParticipants_PreviewKeyDown" 
                              PreviewMouseDoubleClick="dataGridParticipants_PreviewMouseDoubleClick">
                    </DataGrid>
                </DockPanel>
            </TabItem>
            <TabItem Header="Links" Name="tabItemLinks">
                <DockPanel>
                    <Grid Grid.Row="1" DockPanel.Dock="Top">
                        <Grid.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <GradientStopCollection>
                                    <GradientStop Color="#F1F3FF" Offset="0"/>
                                    <GradientStop Color="#E2E8FF" Offset="0.5"/>
                                    <GradientStop Color="#C8DFF7" Offset="0.51"/>
                                    <GradientStop Color="#CAE2F9" Offset="1"/>
                                </GradientStopCollection>
                            </LinearGradientBrush>
                        </Grid.Background>
                        <Grid.Resources>
                            <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Opacity" Value="0.3"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Grid.Resources>
                        <StackPanel Orientation="Horizontal" Margin="0,2,0,2">
                            <Button Name="ButtonAddLink" Click="ButtonAddLink_Click" Padding="2" Margin="2,0,2,0" ToolTip="Link hinzufügen">
                                <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/AddLink.png" Height="16" Width="16" />
                            </Button>
                            <Button Name="ButtonDeleteLink" Click="ButtonDeleteLink_Click" Padding="2" ToolTip="Link löschen">
                                <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/DeleteLink.png" Height="16" Width="16" />
                            </Button>
                        </StackPanel>
                    </Grid>
                    <DataGrid CanUserAddRows="false" CanUserDeleteRows="false" AutoGenerateColumns="False" Name="dataGridLinks" Background="Transparent"
                              CanUserSortColumns="False" CanUserResizeRows="False" SelectionChanged="dataGridLinks_SelectionChanged"
                              BorderThickness="0" HeadersVisibility="Column" RowHeaderWidth="0" SelectionUnit="FullRow" EnableRowVirtualization="True" EnableColumnVirtualization="False" PreviewKeyDown="dataGridLinks_PreviewKeyDown">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Typ" Width="150" Binding="{Binding UrlType}"></DataGridTextColumn>
                            <DataGridTemplateColumn Header="Link" Width="*">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <DockPanel>
                                            <Button DockPanel.Dock="Right" Click="ButtonLinksUrl_Click" ToolTip="{sr:Loc ShowWebsite}">
                                                <Button.Style>
                                                    <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >
                                                    </Style>
                                                </Button.Style>
                                                <Image Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/Internet.png" Width="12" Height="12" />
                                            </Button>
                                            <TextBlock Text="{Binding Link}" />
                                        </DockPanel>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                                <DataGridTemplateColumn.CellEditingTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding Link}" BorderThickness="0" Margin="0" Padding="0"  />
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellEditingTemplate>
                            </DataGridTemplateColumn>
                            <!--<DataGridTextColumn Header="Link" Width="*" Binding="{Binding Link}"></DataGridTextColumn>-->
                        </DataGrid.Columns>
                    </DataGrid>
                </DockPanel>
            </TabItem>
            <TabItem Header="Kommentar" Name="tabItemComment">
                <Grid>
                    <TextBox Text="{Binding Comment}" Name="textBoxComment" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" />
                </Grid>
            </TabItem>
        </TabControl>
        <Button Height="23" HorizontalAlignment="Left" Margin="12,0,0,12" Name="buttonSearchData" VerticalAlignment="Bottom" Click="buttonSearchData_Click">
            <StackPanel Orientation="Horizontal">
                <Image Width="16" Height="16" Source="pack://application:,,,/Big3.Hitbase.SharedResources;component/Images/Internet.png" />
                <TextBlock Margin="5,0,5,0" Text="Weitere Informationen suchen" />
            </StackPanel>
        </Button>
        <Button Content="OK" Height="23" HorizontalAlignment="Right" Margin="0,0,93,12" Name="buttonOK" VerticalAlignment="Bottom" Width="75" Click="buttonOK_Click" IsDefault="True" />
        <Button Content="Abbrechen" Height="23" HorizontalAlignment="Right" Margin="0,0,12,12" Name="buttonCancel" VerticalAlignment="Bottom" Width="75" Click="buttonCancel_Click" IsCancel="True" />
        <my:WaitProgress HorizontalAlignment="Left" Margin="210,15,0,14" Name="waitProgress1" VerticalAlignment="Bottom" WaitProgressColor="Black" Visibility="Collapsed" >
            <my:WaitProgress.LayoutTransform>
                <ScaleTransform ScaleX="0.6" ScaleY="0.6" />
            </my:WaitProgress.LayoutTransform>
        </my:WaitProgress>
    </Grid>
</UserControl>
